#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QColor>
#include <QGridLayout>
#include "qrenderarea.h"
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QDialogButtonBox>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_selectColorButton_clicked();

    void on_buttonBox_accepted();

    void on_actionMy_dialog_triggered();

    void onSaveAs();

private:
    Ui::MainWindow *ui;
    QColor color;
    QGridLayout *mainLayout;
    QRenderArea *renderArea;
    QLabel *textLabel;
    QLineEdit *textEdit;
    QLabel *diameterLabel;
    QLineEdit *diameterEdit;
    QLabel *textErrorMessage;
    QLabel *diameterErrorMessage;
    QPushButton *selectColorButton;
    QDialogButtonBox *buttonBox;

    bool textValidationFailed;
    bool diameterValidationFailed;

    void openDialog();
    bool isValid();
    void openDialogAndDrawOnMainWindow();
};

#endif // MAINWINDOW_H
